package jasima.engine.simulate.execute;

import jasima.core.simulation.Simulation;
import jasima.engine.models.simulate.ExecScheme;
import jasima.engine.models.simulate.shop.ExecWorkStation;
import jasima.shopSim.core.WorkStation;
import lombok.Data;

@Data
public class SimExector implements Runnable{
    private SimData simData;
    private Simulation s = null;

    public SimExector(SimData simData){
        this.simData = simData;
    }

    @Override
    public void run() {
        s = new Simulation();
        ShopExector shop= simData.getShop();
        ExecScheme execScheme = simData.getExecScheme();
        s.addComponent(shop);

        s.setSimulationLength(simData.getSimulationLength());

        for(ExecWorkStation execWorkStation : execScheme.getShop().getWorkStations()){
            WorkStation workStation = new WorkStation(execWorkStation.getMachines().size());
            execWorkStation.setWorkStation(workStation);
            shop.addMachine(workStation);
        }

        s.performRun();
        report();
    }

    private void report() {
    }
}
